﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.ManutencaoOrdens.Communication.Translator.DataContractToModel
{
    public class Mercado
    {
        private Model.Mercado ToMercado(Bovespa.Titulo.Mercado.MercadoResponse from)
        {
            Model.Mercado to = null;

            if (from != null)
            {
                to = new Model.Mercado();

                to.Codigo = from.Codigo;
                to.Descricao = from.Descricao;
            }

            return to;
        }

        public ModelCollection<Model.Mercado> ToMercado(List<Bovespa.Titulo.Mercado.MercadoResponse> from)
        {
            ModelCollection<Model.Mercado> to = null;

            if (from != null)
            {
                to = new ModelCollection<Model.Mercado>();

                foreach (Bovespa.Titulo.Mercado.MercadoResponse item in from)
                {
                    to.Add(ToMercado(item));
                }
            }

            return to;
        }
    }
}
